#!/bin/bash

mkdir -p $PWD/logs
# mkdir -p $PWD/monitor

if [ -z "`docker images | grep foreveross/ab-monitor`" ]; then
    sudo docker load < $PWD/ab-monitor.tar
fi

docker build -t foreveross/ab-monitor $PWD/start-image

docker rm -f ab-monitor

docker run -d --restart=on-failure:5 --net=host \
    -v $PWD/tomcat/conf:/usr/local/tomcat/conf \
    -v $PWD/logs:/usr/local/tomcat/logs \
    --name ab-monitor foreveross/ab-monitor
